package com.xuanwei.core.validate;

import com.xuanwei.core.annos.Money;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.math.BigDecimal;

/**
 * @Author jiangyong
 * @Description TODO
 * @Date 2019/8/19 18:24
 **/
public class MoneyValidate implements ConstraintValidator<Money, BigDecimal> {

    @Override
    public boolean isValid(BigDecimal value, ConstraintValidatorContext context) {
        if (value != null && value.intValue() > 0) {
            return true;
        }
        return false;
    }

    @Override
    public void initialize(Money constraintAnnotation) {

    }
}
